<?php

// include el php que haga el logueo y setee las variables de sesion
$language = 'es_ES';
if (isset($_SESSION['idioma'])) {
    $language = $_SESSION['idioma'];
}
//setlocale(LC_ALL, $language);
//putenv("LANGUAGE=$language");
//bindtextdomain("default",  "./locale");
//bind_textdomain_codeset("default", 'UTF-8');
//textdomain("default");

try {
    $directory = './locale';
    $domain = 'default';
    $locale = $language . ".utf8";
    putenv("LANGUAGE=" . $locale);
    setlocale(LC_MESSAGES, $locale);
    bindtextdomain($domain, $directory);
    textdomain($domain);
    bind_textdomain_codeset($domain, 'UTF-8');
} catch (Exception $exc) {
    echo $exc->getTraceAsString();
}
?>
